﻿<UserControl x:Class="PrestoDashboard.Tabs.LogMessageView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="600" d:DesignWidth="700">
    <UserControl.DataContext>
        <Binding Source="{StaticResource LogMessageViewModel}"/>
    </UserControl.DataContext>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="40"/>
        </Grid.RowDefinitions>

        <DockPanel Grid.Column="0">
            <DataGrid AutoGenerateColumns="False" IsReadOnly="True" HeadersVisibility="Column"
                      ItemsSource="{Binding LogMessages}">
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding Path=MessageCreatedTime}" Header="Time" Width="150"/>
                    <DataGridTextColumn Binding="{Binding Path=Message}" Header="Message" Width="*"/>
                    <DataGridTextColumn Binding="{Binding Path=UserName}" Header="User" Width="150"/>
                </DataGrid.Columns>
            </DataGrid>
        </DockPanel>

        <StackPanel Grid.Row="1">
            <Button Content="Refresh" Style="{StaticResource StandardButton}" Command="{Binding RefreshCommand}" />
        </StackPanel>

    </Grid>
</UserControl>
